package com.lhs.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lhs.entity.blog.blog_like;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
* @author 15977
* @description 针对表【blog_like(点赞记录表)】的数据库操作Mapper
* @createDate 2025-09-11 09:04:15
* @Entity com.lhs.blog.blog_like
*/
@Mapper
public interface blog_likeMapper extends BaseMapper<blog_like> {

    //删除点赞记录
    @Select("DELETE FROM blog_like WHERE post_id = #{postId} AND user_id = #{userId}")
    void deleteLike(Long postId, Long userId);

   //获取点赞数
    @Select("SELECT COUNT(id) FROM blog_like WHERE post_id = #{postId}")
    Long selectLikeCountByPostId(Long postId);
}




